import BuffUtil from '@/BuffUtil';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 半人马 - 尖镐
 **/
export default class MSK_Pickaxe extends AbilityBase {
    static instance: MSK_Pickaxe;
    buffType: AppBuffType = {
        id: 'buff_MSK_Pickaxe',
        art: this.art,
        name: this.abilityName,
        ubertip: this.ubertip,
        attribute: {
            附加护甲: -5,
        },
        stackCountMax: -1,
        dur: 12,
        isDebuff: true,
    };
    constructor(id: string = 'Mmt0') {
        super(id);
        MSK_Pickaxe.instance = this;
        this.init();
        // se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
        EventManager.onTakeAttack(this.onSpellEffect.bind(this));
    }
    init() {
        BuffUtil.registerBuffType(this.buffType);
    }
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        BuffUtil.addBuff(target, this.buffType.id);
    }
    onSpellEffect(d: DamageEventData) {
        if (GetUnitAbilityLevel(d.source, this.id) == 0) return;
        this.cast(0, 0, d.source, d.target);
    }
}
